*************************************************************************
***** Replication Code for:  										 ****
**** Choulis, Ioannis, Abel Escribà-Folch, & Marius Mehrl 			 ****
**** Preventing Dissent: Secret Police And Protests In Dictatorships ****
**** The Journal of Politics 										 ****
**** Date of Code: 15 August 2023 									 ****
*************************************************************************


***************************************************************
***************************************************************
**** Analysis reported in paper and supplementary material ****
***************************************************************
***************************************************************

* PLEASE NOTE: For replication, please change file paths to reflect where you have stored this code and data. Please also ensure to use the following folder structure:
* Folder 1 (highest level) - Files: Replication_Analysis_SecPolice_Protest.do; Replication_Merge_SecPolice_Protest.do; Replication_secpol_protest; Folder: "Source data"
* Folder 2 (Source data): Files: All remaining .dta, .csv, .xls, and .do files EXCEPT 
* 1: 08_15_23_0925am_wep.csv and varlabel.do, these should be in folder "WB pop and GDP pc" within Source data
* 2: GWF-personalism-measure.do and GWF.dta, these should be in folder "GWF Personalization" within Source data

* Please also create an empty folder "Temp" within Source data

* Non-standard Stata packages required for this code: btscs.ado, reghdfe, coefplot, did_imputation, eventstudyinteract, sensemakr



*************
* load data *
*************
* Initial Dataset
*use "C:\Users\mariu\Dropbox\Secret Police Protest\Data\SecPolice_ProtestOpress.dta", clear

* Re-constructed Dataset
use "C:\Users\mariu\Dropbox\Secret Police Protest\Data\Replication\Replication_secpol_protest.dta", clear

********************************
* final variable constructions *
********************************
sum mean5 
gen Protest = (mean5-r(mean))/(r(sd))  /* Standardized Protest variable */
sum nbr_mean5
gen nbr_protest = (nbr_mean5-r(mean))/(r(sd))
	
gen ln_pop = ln(pop+1)
gen ln_gdppc = ln(gdp_pc+1)
gen ln_counterb = ln(effective+1)

label variable Protest "Latent Protest (NB IRT, standardized)"
label variable nbr_protest "Latent Neighbor Protest (NB IRT, standardized)"
label variable ln_pop "Population size, logged"
label variable ln_gdppc "GDP per capita, logged"
label variable ln_counterb "effective Number of Military Orgs, logged"

xtset ccode year

replace Region="Americas" if Region=="na" | Region=="lac"
replace Region="South-East Asia and Pacific" if Region=="eap" | Region=="sa"
replace Region="Europe and Central Asia" if Region=="eca"
replace Region ="MENA" if Region=="mena"
replace Region ="Sub-Saharan Africa" if Region=="ssa"

gen region=.
replace region=1 if Region=="Americas"
replace region=2 if Region=="South-East Asia and Pacific"
replace region=3 if Region=="Europe and Central Asia"
replace region=4 if Region=="MENA"
replace region=5 if Region=="Sub-Saharan Africa"
by ccode: egen region2=max(region)
replace region2=3 if ccode==348
replace region2=2 if ccode==817
replace region=region2 
drop region2
label variable region "Region (numeric)"

* Construct regime cases  from chisols data
gen regimecase=(ccode*1000)+year if l.solsch==1
by ccode: replace regimecase=regimecase[_n-1] if regimecase==.
replace regimecase=ccode if regimecase==. &  solsch!=.
label variable regimecase "Regime Case"

* Construct time since events covariates for robustness checks and Correlates of secret Police Existence
btscs secretpol_revised year ccode, gen(ts_secpol)
btscs attempt year ccode, gen(ts_coup)

gen democ=0 if polity2!=.
replace democ=1 if polity2>=7 & polity2!=.
btscs democ year ccode, gen(ts_democ)
replace ts_democ=ts_democ+1 if democ==0
by ccode: gen obsnum=[_n] if ts_democ!=.
gen everdemoc=1 if ts_democ<obsnum
replace everdemoc=0 if ts_democ==obsnum & ts_democ!=.
drop obsnum democ

label variable ts_secpol "Time since last secret police instance"
label variable ts_coup "Time since last coup attempt"
label variable ts_democ"Time since last democracy instance"
label variable everdemoc "Previously democratic"

* Some analyses require hardcoded lagged variables
gen lag_ln_pop=l.ln_pop
gen lag_ln_gdppc=l.ln_gdppc
gen lag_lexclpop=l.lexclpop


* Define estimation sample
quietly reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc nbr_protest l.lexclpop l12gr intrastate attempt, absorb(ccode year) vce(cluster ccode) nocons
gen sample=e(sample) & year>=1960



************************
*** Figures in Paper ***
************************
* Figure 1 Paper
preserve
gen case=1 if secretpol_revised!=.
collapse (sum) secretpol_revised case, by(region year)
gen share=secretpol_revised/case
*twoway bar  share region, scheme(plotplain) fcolor(grey)
*graph bar share, over(region, gap(1) relabel(1 "Americas" 2 "South-East Asia & Pacific" 3 "Europe & Central Asia" 4 "MENA" 5 "Sub-Saharan Africa")) scheme(plotplain) ytitle("Secret Police (% of country-years)")
graph bar share, over(region, gap(1) relabel(1 "Americas" 2 `" "South-East Asia" "& Pacific" "' 3 `" "Europe &" "Central Asia" "' 4 "MENA" 5 "Sub-Saharan Africa") sort(1) descending ) scheme(plotplain) ytitle("Secret Police (% of country-years)") ylabel(#9)
restore

* Figure 2 Paper
reghdfe Protest secretpol_ if sample==1, absorb(ccode year) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_) level(90) post
estimates store one
reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop if sample==1, absorb(ccode year) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_) level(90) post
estimates store two
reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt if sample==1, absorb(ccode year) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_) level(90) post
estimates store three

reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(ccode) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_) level(90) post
estimates store eight
xtreg Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt i.year, re vce(cluster ccode)
margins, dydx(secretpol_) level(90) post
estimates store four
reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(regimecase year) vce(cluster regimecase) nocons residuals
margins, dydx(secretpol_) level(90) post
estimates store five

coefplot (one, label(Country- & Year-FE | No controls)) (two, label(Country- & Year-FE | Structural controls)) (three, label(Country- & Year-FE | Full controls)) (eight, label(Country-FE              | Full controls)) (four, label(RE          & Year-FE | Full controls)) (five, label(Regime- & Year-FE | Full controls)), xline(0) scheme(plotplainblind)  xtitle("Change in Protest") aspectratio(1) yscale(noline) levels(95 90) legend(position(6) cols(2) colgap(*.3) size(*.8)) ylabel(1 " ", noticks)

reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.ln_counterb, absorb(ccode year) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_ l.ln_counterb) level(90) post
estimates store sixA
reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.xpers, absorb(ccode year) vce(cluster ccode) nocons residuals
margins, dydx(secretpol_ l.xpers) level(90) post
estimates store sevenA

coefplot (sixA, label(Country- & Year-FE | Full controls & Counterbalancing)) (sevenA, label(Country- & Year-FE | Full controls & Personalization)), xline(0) scheme(plotplainblind)  xtitle("Change in Protest") aspectratio(1) yscale(noline) levels(95 90) legend(position(6) cols(1) colgap(*.3) size(*.8)) ylabel(1 "Secret Police" 2 "Counterbalancing" 3 "Personalization", noticks)

coefplot (one, label(Country- & Year-FE | No controls)) (two, label(Country- & Year-FE | Structural controls)) (three, label(Country- & Year-FE | Full controls)) (eight, label(Country-FE              | Full controls)) (four, label(RE          & Year-FE | Full controls)) (five, label(Regime- & Year-FE | Full controls)) (sixA, label(Country- & Year-FE | Full controls & Counterbalancing)) (sevenA, label(Country- & Year-FE | Full controls & Personalization)), xline(0) scheme(plotplainblind)  xtitle("Change in Protest") aspectratio(1) yscale(noline) levels(95 90) legend(position(3) cols(1) colgap(*.3) size(*.75)) ylabel(1 "Secret Police" 2 "Counterbalancing" 3 "Personalization", noticks) name(fig_new, replace)
graph export combinedeffects.tif, replace 



*****************************************************
*** Figures and Tables in Supplementary Materials ***
*****************************************************

* Section 1, Table 1 Supplementary Materials - Summary Statistics
sum Protest secretpol_ ln_pop ln_gdppc l12gr lexclpop nbr_protest intrastate attempt v2csantimv v2csprtcpt v2csreprss v2cseeorgs theta_mean ln_counterb xpers urbanpop Capacity v2clrspct v2stfisccap v2terr v2csstruc_1 everdemoc kill disap polpris tort physint mean5 mean3  if sample==1


* Section 2, Table 2 Supplementary Materials - Main Models
eststo clear
reg Protest secretpol_ if sample==1, vce(cluster ccode)
eststo: reghdfe Protest secretpol_ if sample==1, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop if sample==1, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt if sample==1, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 3, Table 3 Supplementary Materials  - Alternative Modelling Strategies: No year-FE; time trends for whole sample as well as unit-specifc 
eststo clear
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt if sample==1, absorb(ccode) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt c.year##c.year##c.year if sample==1, absorb(ccode) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt if sample==1, absorb(i.ccode##c.year) vce(cluster ccode) nocons
esttab using secpol_protest_rob1, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Standard errors clustered on the country.")


* Section 3, Table 4 Supplementary Materials - Alternative Modelling Strategies: RE; Regime-case FE
eststo clear
eststo: xtreg Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, re vce(cluster ccode)
eststo: xtreg Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt i.year, re vce(cluster ccode)
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(regimecase year) vce(cluster regimecase) nocons 
esttab using secpol_protest_rob1a, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Standard errors clustered on the country.") drop(*.year)


* Section 4, Figure 1 Supplementary Materials - Parallel trends analysis
gen secpol_year=year if secretpol_==1
bysort ccode: egen first_secpol = min(secpol_year)
drop secpol_year
bysort ccode: egen sp_ever = max(secretpol_)
gen secpoltime= year-2011 if sp_ever==0 & secretpol_!=.
replace secpoltime=year-first_secpol if sp_ever==1 & secretpol_!=.

gen reonset=1 if secretpol_==1 & l.secretpol_!=1 & year!=first_secpol 
gen reonset_year=year if reonset==1
bysort ccode: replace reonset_year=reonset_year[_n-1] if reonset_year==.
replace secpoltime=year-reonset_year if reonset_year!=.

preserve
keep if sp_ever!=.
collapse (mean) Protest, by(sp_ever secpoltime)
reshape wide Protest, i(secpoltime) j(sp_ever)
graph twoway connect Protest* secpoltime if secpoltime < 0, scheme(plotplainblind) legend(label(1 "No Secret Police") label(2 "Secret Police") pos(6) col(2)) xtitle(" ")
restore

xtreg Protest i.sp_ever##c.secpoltime if secpoltime < 0
margins sp_ever, dydx(secpoltime)
marginsplot, recast(scatter) scheme(plotplainblind) aspect(1) xtitle("Secret Police ever existed") title(" ") ytitle(" Estimated Time Trend")

* Section 4, In-text description of t-tests & table 5 - Checking differences in levels of covariates between treated and untreated units in the pre-treatment period & interacting Control Variables with Time
ttest lag_ln_pop if secpoltime<0, by(sp_ever) unequal
ttest lag_ln_gdppc if secpoltime<0, by(sp_ever) unequal
ttest l12gr if secpoltime<0, by(sp_ever) unequal
ttest lag_lexclpop if secpoltime<0, by(sp_ever) unequal
ttest nbr_protest if secpoltime<0, by(sp_ever) unequal
ttest intrastate if secpoltime<0, by(sp_ever) unequal
ttest attempt if secpoltime<0, by(sp_ever) unequal

eststo clear
eststo: reghdfe Protest secretpol_ cl.ln_pop##c.year cl.ln_gdppc##c.year l12gr cl.lexclpop##c.year c.nbr_protest##c.year i.intrastate##c.year i.attempt##c.year if sample==1, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_robTRENDS, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Model includes Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 4, Table 6 Supplementary Materials - Alternative Diff-in-Diff estimator - Borusyak et al. 2022
eststo clear
eststo: did_imputation Protest ccode year first_secpol if sample==1, controls(lag_ln_pop lag_ln_gdppc l12gr lag_lexclpop nbr_protest intrastate attempt) fe(ccode year) autosample cluster(ccode) maxit(1000) tol(1e-5)
esttab using secpol_protest_borusyak, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Model includes Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 4, Figure 2 Supplementary Materials - Alternative Diff-in-Diff estimator – Sun and Abraham 2022
gen ry = year-first_secpol
gen never_secpol = (first_secpol == .)

       forvalues k = 15(-1)2 {
           gen g_`k' = ry == -`k'
        }
        forvalues k = 0/15 {
             gen g`k' = ry == `k'
        }

gen bin_ry1= (g_15==1 | g_14==1 | g_13==1 | g_12==1 | g_11==1)
gen bin_ry2= (g_10==1 | g_9==1  | g_8==1  | g_7==1  | g_6==1)
gen bin_ry3= (g_5==1  | g_4==1  | g_3==1  | g_2==1)
gen bin_ry4= (g0==1   | g1==1   | g2==1   | g3==1   | g4==1)
gen bin_ry5= (g5==1   | g6==1   | g7==1   | g8==1   | g9==1)
gen bin_ry6= (g10==1  | g11==1  | g12==1  | g13==1  | g14==1)

eventstudyinteract Protest bin_ry1-bin_ry6 if sample==1, cohort(first_secpol) control_cohort(never_secpol) covariates(l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt) absorb(i.ccode i.year) vce(cluster ccode)

matrix C = e(b_iw)
mata st_matrix("A",sqrt(diagonal(st_matrix("e(V_iw)"))))
matrix C = C \ A'
matrix list C
coefplot matrix(C[1]), se(C[2]) levels(95) xline(0) scheme(plotplainblind) aspect(1) ylabel(1 "t-15 - t-11" 2 "t-10 - t-16" 3 "t-5 - t-2" 4 "t - t+4" 5 "t+5 - t+9" 6 "t+10 - t+14") xtitle("Change in Protest")


* Section 5, Table 7 Supplementary Materials - Alternative Dependent Variables
eststo clear
eststo: reghdfe v2cseeorgs secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe v2csreprss secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe v2csprtcpt secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe v2csantimv secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_vdemdv, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 6, Table 8 Supplementary Materials - Additional Control Variables
eststo clear
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.theta_mean, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.ln_counterb, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.xpers, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.urbanpop, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_rob2, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 6, Table 9 Supplementary Materials - Additional Control Variables: State Capacity
eststo clear
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.Capacity, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.v2clrspct, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.v2stfisccap, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.v2terr, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_statecap, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 6, Table 10 Supplementary Materials - Additional Control Variables: Civil society strength
eststo clear
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.v2csstruc_1, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt l.v2csantimv, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt everdemoc, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt c.ts_democ##c.ts_democ##c.ts_democ, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_civilsoc, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 7, Figure 3 Supplementary Materials - Sensitivitiy to unobserved confounders (Colour changed via plot editor, sensemakr includes no option for doing so)
sensemakr Protest secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt i.ccode i.year, treat(secretpol_) gbenchmark(intrastate attempt) contourplot kd(1 3 5 7 9)


* Section 8, Table 11 Supplementary Materials - Alternative IRT models
eststo clear
eststo: reghdfe mean5 secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_mean5 intrastate attempt if sample==1, absorb(ccode year) vce(cluster ccode) nocons
eststo: reghdfe mean3 secretpol_ l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_mean3 intrastate attempt if sample==1, absorb(ccode year) vce(cluster ccode) nocons
esttab using secpol_protest_rob3, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("All models include Country- and Year-fixed effects; Standard errors clustered on the country.")


* Section 9, Table 12 Supplementary Materials - Correlates of Secret Police Existence
eststo clear
eststo: logit secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
eststo: logit secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate c.ts_coup##c.ts_coup c.ts_secpol##c.ts_secpol, vce(cluster ccode)
eststo: logit secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate c.ts_coup##c.ts_coup c.ts_secpol##c.ts_secpol l.xpers l.Capacity, vce(cluster ccode)
esttab using secpol_asDV, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Logit models; Standard errors clustered on the country.")


* Section 9, Figure 4 Supplementary Materials - Correlates of Secret Police Existence
logit secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate c.ts_coup##c.ts_coup c.ts_secpol##c.ts_secpol, vce(cluster ccode)
margins, at(ts_coup=(0(2)50)) post
estimates store secpoldv1
logit secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate c.ts_coup##c.ts_coup c.ts_secpol##c.ts_secpol, vce(cluster ccode)
margins, at(ts_secpol=(0(2)50)) post
estimates store secpoldv2
coefplot (secpoldv1, recast(line) ciopts(recast(rline) lpattern(dash)) yscale(range(0 0.3))), bylabel(Time since last Coup Attempt) || (secpoldv2, recast(line) ciopts(recast(rline) lpattern(dash)) yscale(range(0 0.9)) ylabel(#10)), bylabel(Time since last Secret Police) || , scheme(plotplain) at xlabel(0 10 20 30 40 50) byopts(yrescale cols(2))


* Section 10, Table 13 Supplementary Materials - Alternative Dependent Variable: Repression
eststo clear
eststo: xtologit kill secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
eststo: xtologit disap secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
eststo: xtologit polpris secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
eststo: xtologit tort secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
eststo: xtologit physint secretpol_revised l.ln_pop l.ln_gdppc l12gr l.lexclpop nbr_protest intrastate attempt, vce(cluster ccode)
esttab using secpol_protest_dvrepression, se rtf replace star(* 0.1 ** 0.05 *** 0.01) nogaps noomitted nodepvars addnotes("Random effects ordered logit models; Standard errors clustered on the country.")